From 8fecb57312f8a8c023203d6c4ad052d24ea6a88c Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 13 Jul 2002 18:51:28 +0000 Subject: [PATCH] (timeclock-in): Run the new day section if, after rereading the log file, timeclock-last-event is nil, indicating no log file exists yet. Take account of the fact that timeclock-discrepancy will be nil in that case. --- lisp/calendar/timeclock.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el index 21a931297e8..db679b8d55e 100644 --- a/lisp/calendar/timeclock.el +++ b/lisp/calendar/timeclock.el @@ -338,9 +338,11 @@ discover the name of the project." (error "You've already clocked in!") (unless timeclock-last-event (timeclock-reread-log)) - (unless (equal (timeclock-time-to-date - (cadr timeclock-last-event)) - (timeclock-time-to-date (current-time))) + ;; Either no log file, or day has rolled over. + (unless (and timeclock-last-event + (equal (timeclock-time-to-date + (cadr timeclock-last-event)) + (timeclock-time-to-date (current-time)))) (let ((workday (or (and (numberp arg) arg) (and arg 0) (and timeclock-get-workday-function @@ -349,7 +351,7 @@ discover the name of the project." (run-hooks 'timeclock-first-in-hook) ;; settle the discrepancy for the new day (setq timeclock-discrepancy - (- timeclock-discrepancy workday)) + (- (or timeclock-discrepancy 0) workday)) (if (not (= workday timeclock-workday)) (timeclock-log "h" (and (numberp arg) (number-to-string arg)))))) -- 2.30.2